package controllers;

import com.fasterxml.jackson.databind.JsonNode;

import model.Pregunta;
import play.*;
import play.libs.Json;
import play.mvc.*;
import repository.AppModelPreguntador;
import repository.Repositorio;
import views.html.*;

public class Application extends Controller {

	public static Result index() {
		return ok(index.render("Your new application is ready."));
	}

	public static Result primerPreg() {

		response().setContentType("application/json");
		
		AppModelPreguntador preg = new AppModelPreguntador(Repositorio.instance().crearCuestionario());
		
		JsonNode json = Json.toJson(preg);
		
		return ok(json);
	}

}
